package com.qf.day4;

import javax.servlet.ServletException;
import javax.servlet.SingleThreadModel;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @date 2022/3/28
 * @desc     了解即可
 */
@WebServlet(value = "/thread",loadOnStartup = 1)
public class ThreadServlet extends HttpServlet implements SingleThreadModel {


    private  int num;   // 成员变量   对个线程同时操作这个变量  会不会有线程安全问题？？？

    @Override
    public void init() throws ServletException {
        System.out.println("servlet创建了");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        System.out.println("请求来了");
    }
}
